import React, { PureComponent, Component } from 'react';
import moment from 'moment'
import {
    View,
    Text,
    StyleSheet,
    TouchableOpacity
} from 'react-native'
import WXStyle from '../utils/style/wxstyle';
import Style from '../utils/style/style';
import Loading from './loading'
export default class PrimaryButton extends Component {
    constructor(props) {
        super(props)
    }

    render() {
        return (
            <TouchableOpacity style={styles.buttonWrap} onPress={this.props.submit} activeOpacity={0.5} >
                {
                    this.props.disable ?
                        <Loading color='#fff' /> : <Text style={styles.btnText}>{this.props.title}</Text>
                }
            </TouchableOpacity>
        )
    }
}

const styles = StyleSheet.create({
    buttonWrap: {
        width: Style.width - 30,
        height: 46,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: WXStyle.mainColor,
        borderRadius: 10
    },
    btnText: {
        color: '#fff',
        fontSize: 17
    },
})